package cn.jy.map.service.impl;

import java.lang.reflect.Method;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import javax.annotation.PostConstruct;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.jy.map.domain.FiveLink;
import cn.jy.map.domain.GjzLc;
import cn.jy.map.domain.Gjzxx;
import cn.jy.map.domain.JYType;
import cn.jy.map.domain.LcBaseLcblfy;
import cn.jy.map.domain.Nurse;
import cn.jy.map.domain.NurseGjzColligate;
import cn.jy.map.domain.ProviderNurse;
import cn.jy.map.domain.RelDounnur;
import cn.jy.map.domain.RelHistory;
import cn.jy.map.domain.VillageColligate;
import cn.jy.map.domain.Wxjyy;
import cn.jy.map.domain.XyDmRounds;
import cn.jy.map.domain.importantProvider;
import cn.jy.map.domain.UnSuccessInformation.BodyCheckJY;
import cn.jy.map.domain.UnSuccessInformation.BodyCheckMX;
import cn.jy.map.domain.UnSuccessInformation.CreateArchives;
import cn.jy.map.domain.UnSuccessInformation.TogetherProvider;
import cn.jy.map.domain.UnSuccessInformation.UpdateLC;
import cn.jy.map.mapper.GjzDzJwdMapper;
import cn.jy.map.mapper.GjzLcMapper;
import cn.jy.map.mapper.GjzxxMapper;
import cn.jy.map.mapper.LcblfyMapper;
import cn.jy.map.mapper.VillageColligateMapper;
import cn.jy.map.service.LcBlfyService;
import cn.jy.map.utils.GjzType;
import cn.jy.map.utils.MapUtils;
import cn.jy.nvr.datasource.DataSourceConst;
import cn.jy.nvr.datasource.DataSourceContextHolder;

@Service("lcBlfyService")
public class LcBlfyServiceImpl implements LcBlfyService {

	@Autowired
	LcblfyMapper lcblfyMapper;
	@Autowired
	GjzDzJwdMapper gjzDzJwdMapper;
	@Autowired
	GjzLcMapper gjzLcMapper;
	@Autowired
	GjzxxMapper gjzxxMapper;
	@Autowired
	VillageColligateMapper villageColligateMapper;


	Logger logger = Logger.getLogger(LcBlfyServiceImpl.class);

	@Override
	public LcBaseLcblfy getLcBlfy(String providerNo, String date) {

		logger.info("获取【"+providerNo+"】在【"+date+"】发生的临床不良反应！");
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		List<LcBaseLcblfy> blfyList = lcblfyMapper.getBlfyByProviderNo(providerNo, date);

		LcBaseLcblfy blfy = null;

		if(blfyList != null && blfyList.size()>0){
			blfy = blfyList.get(0);

			String code = blfy.getFsjd();
			String name = lcblfyMapper.getBlfyDmName(code, "LC_DM_FSJD");
			blfy.setFsjd(name);

			code = blfy.getLcblfyxx();
			if(code != null && code.length()>0){
				String[] co = code.split(";");
				name = "";
				for(String c : co){
					String tempName = lcblfyMapper.getBlfyDmName(c, "LC_DM_LCBLFYXX");
					name += tempName+";";
				}
				blfy.setLcblfyxx(name);
			}

			code = blfy.getLcblfyfl();
			if(code != null && code.length()>0){
				String[] co = code.split(";");
				name = "";
				for(String c : co){
					String tempName = lcblfyMapper.getBlfyDmName(c, "LC_DM_LCBLFYFL");
					name += tempName+";";
				}
				blfy.setLcblfyfl(name);
			}

			String hsxm = blfy.getHsxm();
			hsxm = gjzxxMapper.getNurseById(hsxm);
			blfy.setHsxm(hsxm);

			code = blfy.getLcblfyyy();
			if(code != null && code.length()>0){
				String[] co = code.split(";");
				name = "";
				for(String c : co){
					String tempName = lcblfyMapper.getBlfyDmName(c, "LC_DM_LCBLFYYY");
					name += tempName+";";
				}
				blfy.setLcblfyyy(name);
			}


			code = blfy.getLchfqk();
			if(code != null && code.length()>0){
				String[] co = code.split(";");
				name = "";
				for(String c : co){
					String tempName = lcblfyMapper.getBlfyDmName(c, "LC_DM_LCHFQK");
					name += tempName+";";
				}
				blfy.setLchfqk(name);
			}
			code = blfy.getLcclcs();
			if(code != null && code.length()>0){
				String[] co = code.split(";");
				name = "";
				for(String c : co){
					String tempName = lcblfyMapper.getBlfyDmName(c, "LC_DM_LCCLCS");
					name += tempName+";";
				}
				blfy.setLcclcs(name);
			}

			String sfyhf = blfy.getSfyhf();
			if("1".equals(sfyhf)){
				blfy.setSfyhf("是");
			}else{
				blfy.setSfyhf("否");
			}


			String ass = blfy.getAssessor();
			ass = gjzxxMapper.getNurseById(ass);
			blfy.setAssessor(ass);


			code = blfy.getHffs();
			name = lcblfyMapper.getBlfyDmName(code, "LC_DM_HFFS");
			blfy.setHffs(name);


			code = blfy.getHfjg();
			name = lcblfyMapper.getBlfyDmName(code, "LC_DM_HFJG");
			blfy.setHfjg(name);

			String macId = blfy.getMac_id();
			if(macId != null && !"".equals(macId)){
				String macName = lcblfyMapper.getMacCodeById(macId);
				blfy.setMac_id(macName);
			}

		}

		return blfy;
	}



	@Override
	public List<String> getSameTimeComed(String providerNo, String date, String address,String nurseId) {

		DataSourceContextHolder.setDataSourceType(DataSourceConst.jingying);
		List<String> comedAllPNo = lcblfyMapper.getComedAllPNo(date);

		List<String> list = null;

		if(nurseId != null && !"".equals(nurseId)){
			//查询某个护士管理下面的人具体某一天一起来献浆的浆员集合
			DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
			list = lcblfyMapper.getNurseConnProviderNoList(nurseId,MapUtils.getThatYear(MapUtils.getCurrentYear(), -56));

			if(list != null){
				list.retainAll(comedAllPNo);
			}

		}else if(address != null && !"".equals(address)){
			logger.info("获取和浆员【"+providerNo+"】在【"+date+"】同一天来的同村的浆员！");
			//
			DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
			list = gjzxxMapper.getProviderByAddress(address);
			if(list != null){
				list.retainAll(comedAllPNo);
			}
		}else{
			list = comedAllPNo;
		}


		if(list.size() == 0){
			list.add(providerNo);
		}
		return list;
	}

	@Override
	public List<Nurse> getNurse() {
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		return lcblfyMapper.getNurse();
	}



	@Override
	public void updateProviderManageMsg(List<ProviderNurse> providerNurse) throws Exception {


		//更新护士信息
		this.updateProviderNurse(providerNurse);
		updateJyType(providerNurse);

	}
	private void updateJyType(List<ProviderNurse> providerNurse) throws Exception{
		if(providerNurse != null && providerNurse.size()>0){
			DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
			for (ProviderNurse ps : providerNurse) {
				if (ps.getVillId()!=null) {
					ps.setProviderNo(ps.getProviderNo());
					ps.setVillId(ps.getVillId());
					gjzLcMapper.updateImportproviderNo(ps);
				}
			}
		}
	}
	private void updateProviderNurse(List<ProviderNurse> providerNurse) throws Exception {
		if(providerNurse != null && providerNurse.size()>0){
			logger.info("更新浆员的管理护士信息【"+providerNurse.size()+"】条");
			DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
			for (ProviderNurse pn : providerNurse) {
				logger.info("更新浆员【"+pn.getProviderNo()+"】的管理护士为【"+pn.getNurseId()+"】");

				List<RelDounnur> dounnur = lcblfyMapper.getRelDounnur(pn.getProviderNo());
				if(dounnur != null && dounnur.size()>0){
					RelDounnur dou = dounnur.get(0);

					String hsxm = dou.getHsxm();
					if( !hsxm.equals(pn.getNurseId())){
						//如果不同，就更新，相同就不管

						RelHistory his = new RelHistory();
						his.setHid(UUID.randomUUID().toString());
						his.setBhs(dou.getHsxm());
						his.setAhs(pn.getNurseId());
						his.setXgsj(MapUtils.getNow());
						his.setRelid(dou.getRelid());

						dou.setHsxm(pn.getNurseId());

						lcblfyMapper.updateRelDounnur(dou);
						lcblfyMapper.saveRRelHistory(his);

						//修改轮次表中的链接护士
						String nurse = gjzxxMapper.getNurseById(pn.getNurseId());
						GjzLc lc = new GjzLc();
						lc.setManageNurse(nurse);
						lc.setManageNurseId(pn.getNurseId());
						lc.setProviderNo(pn.getProviderNo());
						gjzLcMapper.updateGjzLcNurse(lc);
					}


				}else{
					//没有，就添加
					String nurseId = pn.getNurseId();
					if(nurseId != null && !"".equals(nurseId)){

						Gjzxx gjz = gjzxxMapper.getGjzByProviderNo(pn.getProviderNo());

						RelDounnur dou = new RelDounnur();
						dou.setRelid(UUID.randomUUID().toString());
						dou.setReltime(MapUtils.getNow());
						dou.setHsxm(pn.getNurseId());
						dou.setJyxm(gjz.getID());
						dou.setJydz(gjz.getDZ());
						dou.setSftx("0");
						dou.setTxfs("1");
						dou.setSfsywx("0");

						lcblfyMapper.saveRelDounnur(dou);

						//修改轮次表中的链接护士
						String nurse = gjzxxMapper.getNurseById(pn.getNurseId());
						GjzLc lc = new GjzLc();
						lc.setManageNurse(nurse);
						lc.setManageNurseId(pn.getNurseId());
						lc.setProviderNo(pn.getProviderNo());
						gjzLcMapper.updateGjzLcNurse(lc);
					}


				}

			}


		}
	}



	@Override
	public List<Wxjyy> getGtjl(String providerNo) {
		logger.info("获取浆员【"+providerNo+"】的未献浆原因！");
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		return lcblfyMapper.getGtReason(providerNo);
	}



	@Override
	public List<RelHistory> getNurseChangeHis(String providerNo) {
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		logger.info("获取【"+providerNo+"】的护士修改历史");
		return lcblfyMapper.getRRelHistory(providerNo);
	}



	@Override
	public List<String> getNurseVill(String nurseId) {
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		logger.info("获取【"+nurseId+"】的所有连接浆员所属的村落");
		return lcblfyMapper.getNurseVill(nurseId);
	}








	@Override
	public String getLinkHj(String code) {
		return lcblfyMapper.getLinkHj(code);
	}



	@Override
	public String getLinkXG(String code) {

		return lcblfyMapper.getLinkXG(code);
	}



	@Override
	public String getLinkCN(String code) {

		return lcblfyMapper.getLinkCN(code);
	}




	@Override
	public void updateGjzLcLink(GjzLc gjzLcs) {
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		List<GjzLc> gjzLcByFiveLink = gjzLcMapper.getGjzLcByFiveLink();
		for (GjzLc gjzLc : gjzLcByFiveLink) {		
			if (gjzLc.getRound1()!=null&& !gjzLc.getRound1().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound1().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound1().substring(0, 1).equals("1")) {
					gjzLc.setRound1("3:"+gjzLc.getRound1().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound1().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound1().substring(0, 1).equals("2")) {
					gjzLc.setRound1("4:"+gjzLc.getRound1().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound1(gjzLc.getRound1());
				}
			}
			if (gjzLc.getRound2()!=null&& !gjzLc.getRound2().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound2().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound2().substring(0, 1).equals("1")) {
					gjzLc.setRound2("3:"+gjzLc.getRound2().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound2().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound2().substring(0, 1).equals("2")) {
					gjzLc.setRound2("4:"+gjzLc.getRound2().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound2(gjzLc.getRound2());
				}
			}
			if (gjzLc.getRound3()!=null&& !gjzLc.getRound3().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound3().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound3().substring(0, 1).equals("1")) {
					gjzLc.setRound3("3:"+gjzLc.getRound3().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound3().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound3().substring(0, 1).equals("2")) {
					gjzLc.setRound3("4:"+gjzLc.getRound3().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound3(gjzLc.getRound3());
				}
			}
			if (gjzLc.getRound4()!=null&& !gjzLc.getRound4().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound4().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound4().substring(0, 1).equals("1")) {
					gjzLc.setRound4("3:"+gjzLc.getRound4().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound4().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound4().substring(0, 1).equals("2")) {
					gjzLc.setRound4("4:"+gjzLc.getRound4().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound4(gjzLc.getRound4());
				}
			}
			if (gjzLc.getRound5()!=null&& !gjzLc.getRound5().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound5().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound5().substring(0, 1).equals("1")) {
					gjzLc.setRound5("3:"+gjzLc.getRound5().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound5().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound5().substring(0, 1).equals("2")) {
					gjzLc.setRound5("4:"+gjzLc.getRound5().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound5(gjzLc.getRound5());
				}
			}
			if (gjzLc.getRound6()!=null&& !gjzLc.getRound6().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound6().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound6().substring(0, 1).equals("1")) {
					gjzLc.setRound6("3:"+gjzLc.getRound6().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound6().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound6().substring(0, 1).equals("2")) {
					gjzLc.setRound6("4:"+gjzLc.getRound6().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound6(gjzLc.getRound6());
				}
			}
			if (gjzLc.getRound7()!=null&& !gjzLc.getRound7().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound7().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound7().substring(0, 1).equals("1")) {
					gjzLc.setRound7("3:"+gjzLc.getRound7().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound7().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound7().substring(0, 1).equals("2")) {
					gjzLc.setRound7("4:"+gjzLc.getRound7().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound7(gjzLc.getRound7());
				}
			}
			if (gjzLc.getRound8()!=null&& !gjzLc.getRound8().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound8().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound8().substring(0, 1).equals("1")) {
					gjzLc.setRound8("3:"+gjzLc.getRound8().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound8().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound8().substring(0, 1).equals("2")) {
					gjzLc.setRound8("4:"+gjzLc.getRound8().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound8(gjzLc.getRound8());
				}
			}
			if (gjzLc.getRound9()!=null&& !gjzLc.getRound9().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound9().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound9().substring(0, 1).equals("1")) {
					gjzLc.setRound9("3:"+gjzLc.getRound9().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound9().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound9().substring(0, 1).equals("2")) {
					gjzLc.setRound9("4:"+gjzLc.getRound9().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound9(gjzLc.getRound9());
				}
			}
			if (gjzLc.getRound10()!=null&& !gjzLc.getRound10().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound10().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound10().substring(0, 1).equals("1")) {
					gjzLc.setRound10("3:"+gjzLc.getRound10().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound10().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound10().substring(0, 1).equals("2")) {
					gjzLc.setRound10("4:"+gjzLc.getRound10().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound10(gjzLc.getRound10());
				}
			}
			if (gjzLc.getRound11()!=null&& !gjzLc.getRound11().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound11().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound11().substring(0, 1).equals("1")) {
					gjzLc.setRound11("3:"+gjzLc.getRound11().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound11().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound11().substring(0, 1).equals("2")) {
					gjzLc.setRound11("4:"+gjzLc.getRound11().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound11(gjzLc.getRound11());
				}
			}
			if (gjzLc.getRound12()!=null&& !gjzLc.getRound12().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound12().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound12().substring(0, 1).equals("1")) {
					gjzLc.setRound12("3:"+gjzLc.getRound12().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound12().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound12().substring(0, 1).equals("2")) {
					gjzLc.setRound12("4:"+gjzLc.getRound12().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound12(gjzLc.getRound12());
				}
			}
			if (gjzLc.getRound13()!=null&& !gjzLc.getRound13().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound13().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound13().substring(0, 1).equals("1")) {
					gjzLc.setRound13("3:"+gjzLc.getRound13().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound13().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound13().substring(0, 1).equals("2")) {
					gjzLc.setRound13("4:"+gjzLc.getRound13().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound13(gjzLc.getRound13());
				}
			}
			if (gjzLc.getRound14()!=null&& !gjzLc.getRound14().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound14().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound14().substring(0, 1).equals("1")) {
					gjzLc.setRound14("3:"+gjzLc.getRound14().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound14().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound14().substring(0, 1).equals("2")) {
					gjzLc.setRound14("4:"+gjzLc.getRound14().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound14(gjzLc.getRound14());
				}
			}
			if (gjzLc.getRound15()!=null&& !gjzLc.getRound15().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound15().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound15().substring(0, 1).equals("1")) {
					gjzLc.setRound15("3:"+gjzLc.getRound15().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound15().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound15().substring(0, 1).equals("2")) {
					gjzLc.setRound15("4:"+gjzLc.getRound15().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound15(gjzLc.getRound15());
				}
			}
			if (gjzLc.getRound16()!=null&& !gjzLc.getRound16().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound16().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound16().substring(0, 1).equals("1")) {
					gjzLc.setRound16("3:"+gjzLc.getRound16().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound16().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound16().substring(0, 1).equals("2")) {
					gjzLc.setRound16("4:"+gjzLc.getRound16().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound16(gjzLc.getRound16());
				}
			}
			if (gjzLc.getRound17()!=null&& !gjzLc.getRound17().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound17().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound17().substring(0, 1).equals("1")) {
					gjzLc.setRound17("3:"+gjzLc.getRound17().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound17().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound17().substring(0, 1).equals("2")) {
					gjzLc.setRound17("4:"+gjzLc.getRound17().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound17(gjzLc.getRound17());
				}
			}
			if (gjzLc.getRound18()!=null&& !gjzLc.getRound18().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound18().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound18().substring(0, 1).equals("1")) {
					gjzLc.setRound18("3:"+gjzLc.getRound18().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound18().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound18().substring(0, 1).equals("2")) {
					gjzLc.setRound18("4:"+gjzLc.getRound18().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound18(gjzLc.getRound18());
				}
			}
			if (gjzLc.getRound19()!=null&& !gjzLc.getRound19().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound19().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound19().substring(0, 1).equals("1")) {
					gjzLc.setRound19("3:"+gjzLc.getRound19().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound19().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound19().substring(0, 1).equals("2")) {
					gjzLc.setRound19("4:"+gjzLc.getRound19().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound19(gjzLc.getRound19());
				}
			}
			if (gjzLc.getRound20()!=null&& !gjzLc.getRound20().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound20().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound20().substring(0, 1).equals("1")) {
					gjzLc.setRound20("3:"+gjzLc.getRound20().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound20().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound20().substring(0, 1).equals("2")) {
					gjzLc.setRound20("4:"+gjzLc.getRound20().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound20(gjzLc.getRound20());
				}
			}
			if (gjzLc.getRound21()!=null&& !gjzLc.getRound21().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound21().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound21().substring(0, 1).equals("1")) {
					gjzLc.setRound21("3:"+gjzLc.getRound21().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound21().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound21().substring(0, 1).equals("2")) {
					gjzLc.setRound21("4:"+gjzLc.getRound21().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound21(gjzLc.getRound21());
				}
			}
			if (gjzLc.getRound22()!=null&& !gjzLc.getRound22().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound22().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound22().substring(0, 1).equals("1")) {
					gjzLc.setRound22("3:"+gjzLc.getRound22().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound22().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound22().substring(0, 1).equals("2")) {
					gjzLc.setRound22("4:"+gjzLc.getRound22().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound22(gjzLc.getRound22());
				}
			}
			if (gjzLc.getRound23()!=null&& !gjzLc.getRound23().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound23().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound23().substring(0, 1).equals("1")) {
					gjzLc.setRound23("3:"+gjzLc.getRound23().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound23().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound23().substring(0, 1).equals("2")) {
					gjzLc.setRound23("4:"+gjzLc.getRound23().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound23(gjzLc.getRound23());
				}
			}
			if (gjzLc.getRound24()!=null&& !gjzLc.getRound24().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound24().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound24().substring(0, 1).equals("1")) {
					gjzLc.setRound24("3:"+gjzLc.getRound24().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound24().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound24().substring(0, 1).equals("2")) {
					gjzLc.setRound24("4:"+gjzLc.getRound24().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound24(gjzLc.getRound24());
				}
			}
			if (gjzLc.getRound25()!=null&& !gjzLc.getRound25().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound25().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound25().substring(0, 1).equals("1")) {
					gjzLc.setRound25("3:"+gjzLc.getRound25().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound25().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound25().substring(0, 1).equals("2")) {
					gjzLc.setRound25("4:"+gjzLc.getRound25().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound25(gjzLc.getRound25());
				}
			}
			if (gjzLc.getRound26()!=null&& !gjzLc.getRound26().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getRound26().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound26().substring(0, 1).equals("1")) {
					gjzLc.setRound26("3:"+gjzLc.getRound26().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getRound26().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound26().substring(0, 1).equals("2")) {
					gjzLc.setRound26("4:"+gjzLc.getRound26().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setRound26(gjzLc.getRound26());
				}
			}
			//判断今年轮次结束
			if (gjzLc.getLastRound1()!=null&& !gjzLc.getLastRound1().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound1().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound1().substring(0, 1).equals("1")) {
					gjzLc.setLastRound1("3:"+gjzLc.getLastRound1().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound1().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound1().substring(0, 1).equals("2")) {
					gjzLc.setLastRound1("4:"+gjzLc.getLastRound1().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound1(gjzLc.getLastRound1());
				}
			}
			if (gjzLc.getLastRound2()!=null&& !gjzLc.getLastRound2().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound2().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound2().substring(0, 1).equals("1")) {
					gjzLc.setLastRound2("3:"+gjzLc.getLastRound2().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound2().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound2().substring(0, 1).equals("2")) {
					gjzLc.setLastRound2("4:"+gjzLc.getLastRound2().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound2(gjzLc.getLastRound2());
				}
			}
			if (gjzLc.getLastRound3()!=null&& !gjzLc.getLastRound3().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound3().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound3().substring(0, 1).equals("1")) {
					gjzLc.setLastRound3("3:"+gjzLc.getLastRound3().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound3().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound3().substring(0, 1).equals("2")) {
					gjzLc.setLastRound3("4:"+gjzLc.getLastRound3().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound3(gjzLc.getLastRound3());
				}
			}
			if (gjzLc.getLastRound4()!=null&& !gjzLc.getLastRound4().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound4().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound4().substring(0, 1).equals("1")) {
					gjzLc.setLastRound4("3:"+gjzLc.getLastRound4().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound4().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound4().substring(0, 1).equals("2")) {
					gjzLc.setLastRound4("4:"+gjzLc.getLastRound4().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound4(gjzLc.getLastRound4());
				}
			}
			if (gjzLc.getLastRound5()!=null&& !gjzLc.getLastRound5().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound5().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound5().substring(0, 1).equals("1")) {
					gjzLc.setLastRound5("3:"+gjzLc.getLastRound5().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound5().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound5().substring(0, 1).equals("2")) {
					gjzLc.setLastRound5("4:"+gjzLc.getLastRound5().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound5(gjzLc.getLastRound5());
				}
			}
			if (gjzLc.getLastRound6()!=null&& !gjzLc.getLastRound6().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound6().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound6().substring(0, 1).equals("1")) {
					gjzLc.setLastRound6("3:"+gjzLc.getLastRound6().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound6().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound6().substring(0, 1).equals("2")) {
					gjzLc.setLastRound6("4:"+gjzLc.getLastRound6().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound6(gjzLc.getLastRound6());
				}
			}
			if (gjzLc.getLastRound7()!=null&& !gjzLc.getLastRound7().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound7().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound7().substring(0, 1).equals("1")) {
					gjzLc.setLastRound7("3:"+gjzLc.getLastRound7().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound7().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound7().substring(0, 1).equals("2")) {
					gjzLc.setLastRound7("4:"+gjzLc.getLastRound7().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound7(gjzLc.getLastRound7());
				}
			}
			if (gjzLc.getLastRound8()!=null&& !gjzLc.getLastRound8().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound8().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound8().substring(0, 1).equals("1")) {
					gjzLc.setLastRound8("3:"+gjzLc.getLastRound8().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound8().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound8().substring(0, 1).equals("2")) {
					gjzLc.setLastRound8("4:"+gjzLc.getLastRound8().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound8(gjzLc.getLastRound8());
				}
			}
			if (gjzLc.getLastRound9()!=null&& !gjzLc.getLastRound9().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound9().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound9().substring(0, 1).equals("1")) {
					gjzLc.setLastRound9("3:"+gjzLc.getLastRound9().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound9().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound9().substring(0, 1).equals("2")) {
					gjzLc.setLastRound9("4:"+gjzLc.getLastRound9().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound9(gjzLc.getLastRound9());
				}
			}
			if (gjzLc.getLastRound10()!=null&& !gjzLc.getLastRound10().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound10().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound10().substring(0, 1).equals("1")) {
					gjzLc.setLastRound10("3:"+gjzLc.getLastRound10().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound10().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound10().substring(0, 1).equals("2")) {
					gjzLc.setLastRound10("4:"+gjzLc.getLastRound10().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound10(gjzLc.getLastRound10());
				}
			}
			if (gjzLc.getLastRound11()!=null&& !gjzLc.getLastRound11().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound11().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound11().substring(0, 1).equals("1")) {
					gjzLc.setLastRound11("3:"+gjzLc.getLastRound11().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound11().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound11().substring(0, 1).equals("2")) {
					gjzLc.setLastRound11("4:"+gjzLc.getLastRound11().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound11(gjzLc.getLastRound11());
				}
			}
			if (gjzLc.getLastRound12()!=null&& !gjzLc.getLastRound12().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound12().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound12().substring(0, 1).equals("1")) {
					gjzLc.setLastRound12("3:"+gjzLc.getLastRound12().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound12().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound12().substring(0, 1).equals("2")) {
					gjzLc.setLastRound12("4:"+gjzLc.getLastRound12().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound12(gjzLc.getLastRound12());
				}
			}
			if (gjzLc.getLastRound13()!=null&& !gjzLc.getLastRound13().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound13().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound13().substring(0, 1).equals("1")) {
					gjzLc.setLastRound13("3:"+gjzLc.getLastRound13().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound13().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound13().substring(0, 1).equals("2")) {
					gjzLc.setLastRound13("4:"+gjzLc.getLastRound13().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound13(gjzLc.getLastRound13());
				}
			}
			if (gjzLc.getLastRound14()!=null&& !gjzLc.getLastRound14().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound14().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound14().substring(0, 1).equals("1")) {
					gjzLc.setLastRound14("3:"+gjzLc.getLastRound14().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound14().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound14().substring(0, 1).equals("2")) {
					gjzLc.setLastRound14("4:"+gjzLc.getLastRound14().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound14(gjzLc.getLastRound14());
				}
			}
			if (gjzLc.getLastRound15()!=null&& !gjzLc.getLastRound15().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound15().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound15().substring(0, 1).equals("1")) {
					gjzLc.setLastRound15("3:"+gjzLc.getLastRound15().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound15().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound15().substring(0, 1).equals("2")) {
					gjzLc.setLastRound15("4:"+gjzLc.getLastRound15().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound15(gjzLc.getLastRound15());
				}
			}
			if (gjzLc.getLastRound16()!=null&& !gjzLc.getLastRound16().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound16().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound16().substring(0, 1).equals("1")) {
					gjzLc.setLastRound16("3:"+gjzLc.getLastRound16().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound16().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound16().substring(0, 1).equals("2")) {
					gjzLc.setLastRound16("4:"+gjzLc.getLastRound16().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound16(gjzLc.getLastRound16());
				}
			}
			if (gjzLc.getLastRound17()!=null&& !gjzLc.getLastRound17().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound17().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound17().substring(0, 1).equals("1")) {
					gjzLc.setLastRound17("3:"+gjzLc.getLastRound17().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound17().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound17().substring(0, 1).equals("2")) {
					gjzLc.setLastRound17("4:"+gjzLc.getLastRound17().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound17(gjzLc.getLastRound17());
				}
			}
			if (gjzLc.getLastRound18()!=null&& !gjzLc.getLastRound18().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound18().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound18().substring(0, 1).equals("1")) {
					gjzLc.setLastRound18("3:"+gjzLc.getLastRound18().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound18().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound18().substring(0, 1).equals("2")) {
					gjzLc.setLastRound18("4:"+gjzLc.getLastRound18().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound18(gjzLc.getLastRound18());
				}
			}
			if (gjzLc.getLastRound19()!=null&& !gjzLc.getLastRound19().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound19().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound19().substring(0, 1).equals("1")) {
					gjzLc.setLastRound19("3:"+gjzLc.getLastRound19().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound19().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound19().substring(0, 1).equals("2")) {
					gjzLc.setLastRound19("4:"+gjzLc.getLastRound19().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound19(gjzLc.getLastRound19());
				}
			}
			if (gjzLc.getLastRound20()!=null&& !gjzLc.getLastRound20().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound20().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound20().substring(0, 1).equals("1")) {
					gjzLc.setLastRound20("3:"+gjzLc.getLastRound20().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound20().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound20().substring(0, 1).equals("2")) {
					gjzLc.setLastRound20("4:"+gjzLc.getLastRound20().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound20(gjzLc.getLastRound20());
				}
			}
			if (gjzLc.getLastRound21()!=null&& !gjzLc.getLastRound21().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound21().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound21().substring(0, 1).equals("1")) {
					gjzLc.setLastRound21("3:"+gjzLc.getLastRound21().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound21().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound21().substring(0, 1).equals("2")) {
					gjzLc.setLastRound21("4:"+gjzLc.getLastRound21().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound21(gjzLc.getLastRound21());
				}
			}
			if (gjzLc.getLastRound22()!=null&& !gjzLc.getLastRound22().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound22().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound22().substring(0, 1).equals("1")) {
					gjzLc.setLastRound22("3:"+gjzLc.getLastRound22().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound22().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound22().substring(0, 1).equals("2")) {
					gjzLc.setLastRound22("4:"+gjzLc.getLastRound22().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound22(gjzLc.getLastRound22());
				}
			}
			if (gjzLc.getLastRound23()!=null&& !gjzLc.getLastRound23().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound23().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound23().substring(0, 1).equals("1")) {
					gjzLc.setLastRound23("3:"+gjzLc.getLastRound23().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound23().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound23().substring(0, 1).equals("2")) {
					gjzLc.setLastRound23("4:"+gjzLc.getLastRound23().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound23(gjzLc.getLastRound23());
				}
			}
			if (gjzLc.getLastRound24()!=null&& !gjzLc.getLastRound24().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound24().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound24().substring(0, 1).equals("1")) {
					gjzLc.setLastRound24("3:"+gjzLc.getLastRound24().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound24().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound24().substring(0, 1).equals("2")) {
					gjzLc.setLastRound24("4:"+gjzLc.getLastRound24().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound24(gjzLc.getLastRound24());
				}
			}
			if (gjzLc.getLastRound25()!=null&& !gjzLc.getLastRound25().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound25().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound25().substring(0, 1).equals("1")) {
					gjzLc.setLastRound25("3:"+gjzLc.getLastRound25().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound25().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound25().substring(0, 1).equals("2")) {
					gjzLc.setLastRound25("4:"+gjzLc.getLastRound25().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound25(gjzLc.getLastRound25());
				}
			}
			if (gjzLc.getLastRound26()!=null&& !gjzLc.getLastRound26().equals("0")&&gjzLc.getLJTIME()!=null) {
				if (gjzLc.getLastRound26().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound26().substring(0, 1).equals("1")) {
					gjzLc.setLastRound26("3:"+gjzLc.getLastRound26().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else if (gjzLc.getLastRound26().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getLastRound26().substring(0, 1).equals("2")) {
					gjzLc.setLastRound26("4:"+gjzLc.getLastRound26().substring(2, 12)+":"+gjzLc.getPERSONNAME());
				}else {
					gjzLc.setLastRound26(gjzLc.getLastRound26());
				}
			}
			gjzLc.setProviderNo(gjzLc.getProviderNo());
			gjzLcMapper.updateGjzLcLink(gjzLc);
			logger.info("更新成功："+gjzLc);
		}


	}
	/*
	@Override
	public void updateGjzLcLink(GjzLc gjzLcs) {

		List<LinkNurse> linkTime=gjzLcMapper.getLinkNurse();
		List<GjzLc> lcList=null;
		for (LinkNurse linkNurse : linkTime) {
			lcList=gjzLcMapper.getGjzLcByFiveLink(linkNurse.getCARDID());
			for (GjzLc gjzLc : lcList) {
				if(!gjzLc.getRound1().equals("0")&&linkNurse.getLJTIME()!=null){
					if (gjzLc.getRound1().substring(2, 12).equals(linkNurse.getLJTIME().substring(0,10))&&gjzLc.getRound1().substring(0, 1).equals("")) {
						gjzLc.setRound1("3:"+gjzLc.getRound1().substring(2, 12)+":"+linkNurse.getPERSONNAME());
					}else if (gjzLc.getRound1().substring(2, 12).equals(gjzLc.getLJTIME().substring(0,10))&&gjzLc.getRound1().substring(0, 1).equals("2")) {
						gjzLc.setRound1("4:"+gjzLc.getRound1().substring(2, 12)+":"+linkNurse.getPERSONNAME());
					}
				}
				gjzLc.setProviderNo(gjzLc.getProviderNo());
				gjzLcMapper.updateGjzLcLink(gjzLc);
				logger.info("更新成功："+gjzLc);
			}
		}

	}
	 */
	@Override
	public List<FiveLink> getFiveLink(String cardId, String date) {
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		return lcblfyMapper.getFiveLink(cardId, date);
	}



	@Override
	public Map<String, Object> getNurseGjzLc(String nurseId, int gjzType, String address) {
		logger.info("获取护士【"+nurseId+"】链接的浆员的综合信息和所有浆员的轮次信息！");
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		Map<String, Object> map = new HashMap<String, Object>();
		//获取护士下面链接的浆员卡号集合
		List<String> allist = null;
		List<String> pList = null;
		if(nurseId != null && !"".equals(nurseId)){
			allist = lcblfyMapper.getNurseConnProviderNoList(nurseId,MapUtils.getThatYear(MapUtils.getCurrentYear(), -56));
		}else{
			allist = MapUtils.allTypeGjzMap.get(GjzType.allGjz);
		}
		/*
		 * 1：忠诚浆员，2：服务浆员，3：今年新浆员，4：休眠浆员，5：流失浆员，6：今年进站的被链接了的浆员，
		 * 7：休眠中未链接浆员，8：今年进站的浆员，9：今年未进站的浆员，10：休眠中已链接的浆员
		 */
		switch (gjzType) {
		case 1:
			pList = MapUtils.allTypeGjzMap.get(GjzType.zhongChengGjz);			
			break;
		case 2:
			pList = MapUtils.allTypeGjzMap.get(GjzType.fuSuGjz);//gjzAllTypeMapper.getfsJy(date, thisYear, lastYear);		
			break;
		case 3:
			pList = MapUtils.allTypeGjzMap.get(GjzType.thisYearCreated);//gjzAllTypeMapper.getNewJy(date, thisYear, lastYear);
			break;
		case 4:
			pList = MapUtils.allTypeGjzMap.get(GjzType.xiuMianGjz);//gjzAllTypeMapper.getXmJy(date, thisYear, lastYear);			
			break;
		case 5:
			pList = MapUtils.allTypeGjzMap.get(GjzType.liuShiGjz);//gjzAllTypeMapper.getLsJy(date, thisYear, lastYear);
			break;
		case 6:
			pList = MapUtils.allTypeGjzMap.get(GjzType.xiuMianBeConnect);// gjzAllTypeMapper.getLjJy("3");//休眠中已链接
			break;
		case 7:
			pList = MapUtils.allTypeGjzMap.get(GjzType.notConnect);//gjzAllTypeMapper.getLjJy(null);//未链接
			break;
		case 8:
			pList = MapUtils.allTypeGjzMap.get(GjzType.thisYearComed);//gjzAllTypeMapper.getThisYearComed(date,thisYear,"3");//今年进站的人
			break;
		case 9:
			pList = MapUtils.allTypeGjzMap.get(GjzType.thisYearNotComed);//gjzAllTypeMapper.getThisYearComed(date,thisYear,null);//今年未进站的人
			break;
		case 10:
			pList = MapUtils.allTypeGjzMap.get(GjzType.xiuMianNotConnect);//休眠中未链接
			break;
		case 11:
			pList=gjzLcMapper.getByNurseId(nurseId);
			break;
		case 12:
			pList=gjzLcMapper.getByNurseIdNotPulp(nurseId);
			break;
		case 13:
			pList=gjzLcMapper.getByNurseIdFiveLink(nurseId);
			break;
		default:
			break;
		}
		if(pList != null && pList.size()>0){
			allist = MapUtils.retainList(allist, pList);
		}

		if(allist != null && allist.size()>0){
			if(address != null && !"".equals(address)){
				//获取指定浆员中，地址为指定地址的那些人
				List<String> aList = gjzDzJwdMapper.getAllProviderNoByAddress(address,MapUtils.getThatYear(MapUtils.getCurrentYear(), -56));
				//					aList.retainAll(allist);

				allist = MapUtils.retainList(aList, allist);
			}
			//获取这些浆员的轮次表
			List<GjzLc> list = null;
			if(allist != null && allist.size()>0){
				if(allist.size() > 2000){
					list = new ArrayList<GjzLc>();
					int num = allist.size() / 2000 + 1;
					for(int j=0;j < num;j++){
						int toIndex = 2000 * j + 2000;
						if(toIndex > allist.size()){
							toIndex = allist.size();
						}
						List<String> subList = allist.subList(2000 * j, toIndex);

						List<GjzLc> tempList = gjzLcMapper.getGjzLcByProviderNo(subList);
						list.addAll(tempList);
					}

				}else{
					list = gjzLcMapper.getGjzLcByProviderNo(allist);
				}
			}else{
				list = new ArrayList<GjzLc>();
			}

			map.put("jylc", list);

		}else{
			map.put("jylc", new ArrayList<GjzLc>());
		}
		//获取护士链接的浆员的综合信息

		if(nurseId != null && !"".equals(nurseId)){
			NurseGjzColligate ngc = new NurseGjzColligate();
			List<NurseGjzColligate> list = lcblfyMapper.getNurseGjzGoll(nurseId);
			if(list != null && list.size()>0){
				ngc = list.get(0);
			}else{
				ngc.setNurseId(nurseId);
				ngc.setNurseName(gjzxxMapper.getNurseById(nurseId));
			}
			map.put("ngc", ngc);
		}else{
			List<VillageColligate> tList = MapUtils.villList;
			VillageColligate vc = null;	
			if(tList.size()>0){
				
			}else {
				tList=getVillStatistics();
				MapUtils.villList=tList;
			}
			
			/*List<VillageColligate> tList = villageColligateMapper.getTotalVillageColligate();
			VillageColligate vc = null;
			if(tList.size()>0){
				vc = tList.get(0);
				SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
				Date now = new Date();
				String lastStartTime=MapUtils.getThatDate(sdf.format(now)+"-01-01", -1,1);
				String lastEndTime=MapUtils.getThatDate(sdf.format(now)+"-01-31", -1, 1);//修改去年总献浆量根据日期查
				DataSourceContextHolder.setDataSourceType(DataSourceConst.jingying);
				vc.setLastYearCollNum(Integer.valueOf(villageColligateMapper.getPulpWeight(MapUtils.getThatDate(lastStartTime, 0, 2), MapUtils.getThatDate(lastEndTime, 11, 2))));
			}else{
				vc = new VillageColligate();
			}*/
			vc=tList.get(0);
			map.put("ngc", vc);
		}
		JYType ngcl=new JYType();
		List<JYType> jyList=new ArrayList<JYType>();
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		switch (gjzType) {
		case 1:
			ngcl.setCurrentTimeZCPNum(allist.size());//忠诚浆员当期总人数
			//根据前台传过来的参数获取到cardID根据卡号统计忠诚浆员信息
			StringBuilder sbzc=new StringBuilder();
			if (allist.size()>0) {
				for (int i = 0; i < allist.size(); i++) {
					sbzc.append("'"+allist.get(i)+"'"+",");
				}
				
				List<JYType> CurrentTimeZCCollNum=gjzLcMapper.getCurrentTimeZCCollNum(sbzc.toString().substring(0,sbzc.length()-1));
				ngcl.setCurrentTimeZCCollNum(CurrentTimeZCCollNum.get(0).getCurrentTimeZCCollNum());//忠诚浆员当期献浆量
				ngcl.setLastYearZCCollNum(CurrentTimeZCCollNum.get(0).getLastYearZCCollNum());//忠诚浆员去年献浆量
			}
			jyList.add(ngcl);
			break;
		case 2:
			//根据前台传过来的参数获取到cardID根据卡号统计忠诚浆员信息
			StringBuilder sbfs=new StringBuilder();
			if (allist.size()>0) {
				for (int i = 0; i < allist.size(); i++) {
					sbfs.append("'"+allist.get(i)+"'"+",");
				}
				List<JYType> FuSuNum=gjzLcMapper.getCurrentTimeZCCollNum(sbfs.toString().substring(0,sbfs.length()-1));
				ngcl.setCurrentTimeFuSuPNum(allist.size()); //复苏浆员人数
				ngcl.setCurrentTimeFuSuCollNum(FuSuNum.get(0).getCurrentTimeZCCollNum());
			}
			jyList.add(ngcl);
			break;
		case 3:
			StringBuilder sbxz=new StringBuilder();
			if (allist.size()>0) {
				for (int i = 0; i < allist.size(); i++) {
					sbxz.append("'"+allist.get(i)+"'"+",");
				}

				List<JYType> XzNum=gjzLcMapper.getCurrentTimeZCCollNum(sbxz.toString().substring(0,sbxz.length()-1));
				ngcl.setCurrentTimeAddPNum(allist.size()); //今年新增
				ngcl.setCurrentTimeAddCollNum(XzNum.get(0).getCurrentTimeZCCollNum());
			}
			jyList.add(ngcl);
			break;
		case 4:
			StringBuilder sbxm=new StringBuilder();
			if (allist.size()>0) {
				for (int i = 0; i < allist.size(); i++) {
					sbxm.append("'"+allist.get(i)+"'"+",");
				}

				List<JYType> XmNum=gjzLcMapper.getCurrentTimeZCCollNum(sbxm.toString().substring(0,sbxm.length()-1));
				ngcl.setXiuMianPNum(allist.size()); //休眠浆员人数
				ngcl.setLastYearXiuMianCollNum(XmNum.get(0).getLastYearZCCollNum());//休眠浆员去年献浆量
			}
			jyList.add(ngcl);
			break;
		case 5:
			ngcl.setLiuShiPNum(allist.size()); //流失浆员总人数
			jyList.add(ngcl);
			break;
		case 6:
			StringBuilder sbxmylj=new StringBuilder();
			if (allist.size()>0) {
				for (int i = 0; i < allist.size(); i++) {
					sbxmylj.append("'"+allist.get(i)+"'"+",");
				}

				List<JYType> xmyljNum=gjzLcMapper.getCurrentTimeZCCollNum(sbxmylj.toString().substring(0,sbxmylj.length()-1));
				ngcl.setLastTimeNotConnXMCollNum(xmyljNum.get(0).getCurrentTimeZCCollNum());//休眠未连接同期献浆量
				ngcl.setConnXMPNum(allist.size()); //已链接休眠浆员人数
			}
			jyList.add(ngcl);
			break;
		case 7:
			StringBuilder sbjzwlj=new StringBuilder();
			if (allist.size()>0) {
				for (int i = 0; i < allist.size(); i++) {
					sbjzwlj.append("'"+allist.get(i)+"'"+",");
				}

				List<JYType> JzWljNum=gjzLcMapper.getCurrentTimeZCCollNum(sbjzwlj.toString().substring(0,sbjzwlj.length()-1));
				ngcl.setComedNotConnThisTimeCollNum(JzWljNum.get(0).getCurrentTimeZCCollNum());//进站未连接今年献浆量
				ngcl.setComedNotConnLastYearCollNum(JzWljNum.get(0).getLastYearZCCollNum());//进站未连接去年献浆量
				ngcl.setComedNotConnPNum(allist.size()); //wei链接浆员人数
			}
			jyList.add(ngcl);
			break;
		case 8:
			StringBuilder sbjnjz=new StringBuilder();
			if (allist.size()>0) {
				for (int i = 0; i < allist.size(); i++) {
					sbjnjz.append("'"+allist.get(i)+"'"+",");
				}
				
				List<JYType> jnjzNum=gjzLcMapper.getCurrentTimeZCCollNum(sbjnjz.toString().substring(0,sbjnjz.length()-1));
				ngcl.setCurrentTimeCollNum(jnjzNum.get(0).getCurrentTimeZCCollNum());//今年进站当期献浆量
				ngcl.setCurrentTimePNum(allist.size()); //今年进站人数
			}
			jyList.add(ngcl);
			break;
		case 9:
			StringBuilder sbjnwjz=new StringBuilder();
			if (allist.size()>0) {
				for (int i = 0; i < allist.size(); i++) {
					sbjnwjz.append("'"+allist.get(i)+"'"+",");
				}

				List<JYType> jnwjzNum=gjzLcMapper.getCurrentTimeZCCollNum(sbjnwjz.toString().substring(0,sbjnwjz.length()-1));
				ngcl.setCurrentTimeNotComedPLastYearCollNum(jnwjzNum.get(0).getLastYearZCCollNum());//今年未进站去年献浆量
				ngcl.setCurrentTimeNotComedPNum(allist.size()); //今年未进站人数
			}
			jyList.add(ngcl);
			break;
		case 10:
			StringBuilder sbxmwlj=new StringBuilder();
			if (allist.size()>0) {
				for (int i = 0; i < allist.size(); i++) {
					sbxmwlj.append("'"+allist.get(i)+"'"+",");
				}

				List<JYType> xmwljNum=gjzLcMapper.getCurrentTimeZCCollNum(sbxmwlj.toString().substring(0,sbxmwlj.length()-1));
				ngcl.setLastTimeNotConnXMCollNum(xmwljNum.get(0).getCurrentTimeZCCollNum());//休眠未连接同期献浆量
				ngcl.setNotConnXMPNum(allist.size()); //休眠未连接
			}
			jyList.add(ngcl);
			break;

		default:
			break;
		}
		map.put("ngcl", jyList);
		return map;
	}




	@Override
	public List<GjzLc> getGjzLc(GjzLc lcCondition) {
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		return gjzLcMapper.getGjzLc(lcCondition);
	}


	@Override
	public List<String> getByVills(String cardId) {
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		return lcblfyMapper.getByVills(cardId);
	}


	@Override
	public void updateLinkState(GjzLc gjzLc) {
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		gjzLcMapper.updateLinkState(gjzLc);

	}



	@Override
	public void updateNoLinkState(GjzLc gjzLc) {
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		gjzLcMapper.updateNoLinkState(gjzLc);

	}
	private String CardId(String startTime,String endTime){
		DataSourceContextHolder.setDataSourceType(DataSourceConst.jingying);
		StringBuilder sb=new StringBuilder();
		CreateArchives cArchives=new CreateArchives();
		cArchives.setStartDate(startTime);
		cArchives.setEndDate(endTime);
		List<CreateArchives> cardId=gjzLcMapper.getNotCjProviderNo(cArchives);
		for (CreateArchives createArchives : cardId) {
			sb.append("'"+createArchives.getProviderNo()+"'"+",");
		}


		return sb.toString();

	}
	@Override
	public List<BodyCheckJY> getJyState(String providerNo) {
		DataSourceContextHolder.setDataSourceType(DataSourceConst.jingying);
		return gjzLcMapper.getJyState(providerNo);
	}



	@Override
	public List<BodyCheckMX> getMXJYState(String CARDID) {
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		return gjzLcMapper.getMXJYState(CARDID);
	}




	@Override
	public List<UpdateLC> getLCByGJZXX(String providerNo,String startTime, String endTime,UpdateLC lc) {
		String result=CardId(startTime, endTime);
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		List<UpdateLC> list = gjzLcMapper.getLCByGJZXX(result.substring(0, result.length()-1));

		for (UpdateLC updateLC : list) {
			String collectionDate=updateLC.getCREATERQ();
			if (collectionDate!=null) {
				collectionDate = MapUtils.formatDate1(collectionDate);
				List<XyDmRounds> xyDmRounds = gjzLcMapper.getXyDmRounds(collectionDate);
				XyDmRounds xyDmRound = null;
				if(xyDmRounds != null && xyDmRounds.size()>0){
					xyDmRound = xyDmRounds.get(0);
					String rid = xyDmRound.getRID();
					if (collectionDate.substring(0, 4).equals((new Date().toString().substring(new Date().toString().length()-4)))) {
						if (updateLC.getCARDID().substring(0, 1).equals("R")) {
							setGjzLcRounds(rid, updateLC,"5:"+collectionDate);
						}
					}else {
						setGjzLcLastYearRounds(rid, updateLC,"5:"+collectionDate);

					}
					updateLC.setProviderNo(updateLC.getCARDID());
					gjzLcMapper.updateLc(updateLC);
					logger.info("更新成功R浆员"+updateLC);
				}else {
					if(xyDmRounds != null && xyDmRounds.size()>0){
						xyDmRound = xyDmRounds.get(0);
						String rid = xyDmRound.getRID();
						setGjzLcLastYearRounds(rid, updateLC,"5:"+collectionDate);

					}
				}
				updateLC.setProviderNo(updateLC.getCARDID());
				gjzLcMapper.updateLc(updateLC);
				logger.info("更新成功R浆员"+updateLC);
			}

		}



		return null;
	}



	private void setGjzLcRounds(String rid,UpdateLC lc,String value){
		try {
			Class<?> clazz = Class.forName("cn.jy.map.domain.UnSuccessInformation.UpdateLC");

			Method setRound = clazz.getMethod("setRound"+rid, String.class);

			setRound.invoke(lc, value);


		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	private void setGjzLcLastYearRounds(String rid,UpdateLC lc,String value){
		try {
			Class<?> clazz = Class.forName("cn.jy.map.domain.UnSuccessInformation.UpdateLC");

			Method setRound = clazz.getMethod("setLastRound"+rid, String.class);

			setRound.invoke(lc, value);


		} catch (Exception e) {
			e.printStackTrace();
		}
	}


	@Override
	public List<String> getByNurseIdFiveLink(String nurseId) {
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		return gjzLcMapper.getByNurseIdFiveLink(nurseId);
	}



	@Override
	public List<TogetherProvider> getByQualified(String CARDID) {
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		List<TogetherProvider> result=null; 
		List<String> providerNo=null;
		String time=gjzLcMapper.getByJDSJ(CARDID);
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");	
		try {
			providerNo=gjzLcMapper.getByCreateRq(sdf.format(new Date(sdf.parse(time).getTime() - 10 * 60 * 1000)),
					sdf.format(new Date(sdf.parse(time).getTime() + 10 * 60 * 1000)));
		} catch (ParseException e) {
			e.printStackTrace();
		}
		StringBuilder  sb=new StringBuilder();
		if (providerNo!=null) {
			for (String string : providerNo) {
				sb.append("'"+string+"'"+",");
			}
			result=gjzLcMapper.getByQualified(sb.toString().substring(0,sb.length()-1),time.substring(0, 10));
		}
		return result;
	}


	@Override
	public void insertZDJYLX() {	
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		gjzLcMapper.insertZDJYLX();
		logger.info("成功添加浆员");		
	}



	@Override
	public List<importantProvider> getJYLXMB() {
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		return gjzLcMapper.getJYLXMB();
	}


	@Override
	public String getByIdJSR(String ID) {
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		return gjzLcMapper.getByIdJSR(ID);
	}


	@Override
	public void updateByJSR() {
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		gjzLcMapper.updateByJSR();
	}
   @Override
	public List<VillageColligate> getVillStatistics() {
	   	logger.info("查询所有浆员献浆信息");
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		int allProviderNum=0;
		int lastYearCollNum = 0;//去年献浆总量/袋
		int currentTimePNum = 0;//当期进站人数 
		int currentTimeCollNum = 0;//当期献浆量/袋	
		int lastTimePNum = 0;//同期进站人数	
		int lastTimeCollNum = 0;//同期献浆量/袋	
		int currentTimeAddPNum = 0;//当期新增人数	
		int currentTimeAddCollNum = 0;//当期新增总浆量/袋	
		int lastTimeAddPNum = 0;//同期新增人数	
		int lastTimeAddCollNum = 0;//同期新增总浆量/袋	
		List<VillageColligate> vilList = new ArrayList<VillageColligate>();
		VillageColligate vill=new VillageColligate();
		List<String> allProvider = gjzDzJwdMapper.getAllProviderNoByAddress(null,MapUtils.getThatYear(MapUtils.getCurrentYear(), -56));	
		List<String> forgeProviderNo = MapUtils.allForgeProviderNo;
		if(allProvider != null && allProvider.size()>0){
			allProvider.removeAll(forgeProviderNo);
		}
		allProviderNum=	allProvider.size();	
		
		//去年献浆总量/袋
		DataSourceContextHolder.setDataSourceType(DataSourceConst.jingying);
		int tempNum = villageColligateMapper.getCollNumsByProviders(MapUtils.getThatYear(MapUtils.getCurrentYear(), -1) + "-01-01", MapUtils.getThatYear(MapUtils.getCurrentYear(), -1) + "-12-31",null);
		lastYearCollNum += tempNum;

		//当期进站人数 、当期献浆量/袋	
		Map<String, Integer> tempMap = villageColligateMapper.getcurrentTimeNum(MapUtils.getCurrentYear(),MapUtils.getNowOnlyDateFomat1(),null);
		int num_1 = tempMap.get("NUM");
		int sumnum_1 = tempMap.get("SUMNUM");

		currentTimePNum += num_1;
		currentTimeCollNum += sumnum_1;

		//同期进站人数 、当期献浆量/袋	
		tempMap = villageColligateMapper.getcurrentTimeNum(MapUtils.getThatYear(MapUtils.getCurrentYear(), -1),MapUtils.getLastYearNow(),null);
		num_1 = tempMap.get("NUM");
		sumnum_1 = tempMap.get("SUMNUM");

		lastTimePNum += num_1;
		lastTimeCollNum += sumnum_1;

		//当期新增人数、当期新增总浆量/袋	
		tempMap = villageColligateMapper.getcurrentTimeAddNum(MapUtils.getCurrentYear(),MapUtils.getNowOnlyDateFomat1(),null);
		num_1 = tempMap.get("NUM");
		sumnum_1 = tempMap.get("SUMNUM");

		currentTimeAddPNum += num_1;
		currentTimeAddCollNum += sumnum_1;

		//同期新增人数 、当期献浆量/袋	
		tempMap = villageColligateMapper.getcurrentTimeAddNum(MapUtils.getThatYear(MapUtils.getCurrentYear(), -1),MapUtils.getLastYearNow(),null);
		num_1 = tempMap.get("NUM");
		sumnum_1 = tempMap.get("SUMNUM");

		lastTimeAddPNum += num_1;
		lastTimeAddCollNum += sumnum_1;	
		vill.setAllProviderNum(allProviderNum);
		vill.setLastYearCollNum(lastYearCollNum);
		vill.setCurrentTimePNum(currentTimePNum);
		vill.setCurrentTimeCollNum(currentTimeCollNum);
		vill.setLastTimePNum(lastTimePNum);
		vill.setCurrentTimeAddCollNum(currentTimeAddCollNum);
		vill.setLastTimeCollNum(lastTimeCollNum);
		vill.setCurrentTimeAddPNum(currentTimeAddPNum);
		vill.setLastTimeAddPNum(lastTimeAddPNum);
		vill.setLastTimeAddCollNum(lastTimeAddCollNum);
		List<String> fsProvider = MapUtils.retainList(allProvider, MapUtils.allTypeGjzMap.get(GjzType.fuSuGjz));
		int CurrentTimeFuSuPNum=fsProvider.size();//当期复苏献浆员总人数	
		int currentTimeFuSuCollNum = 0;//当期复苏浆员献浆总量/袋	
		currentTimeFuSuCollNum = villageColligateMapper.getCollNumsByProviders(MapUtils.getCurrentYear()+"-01-01",MapUtils.getNowOnlyDateFomat1(),fsProvider);

		int currentTimeZCPNum = 0;//忠诚献浆员当期总人数	
		int currentTimeZCCollNum = 0;//忠诚献浆员当期献浆总量	
		int lastTimeZCPNum = 0;//忠诚献浆员同期期总人数	
		int lastTimeZCCollNum = 0;//忠诚献浆员同期献浆总量	
		int lastYearZCCollNum = 0;//忠诚浆员去年全年献浆量	
		Map<String, Integer> tempMaps = villageColligateMapper.getZCAllNums(MapUtils.getThatYear(MapUtils.getCurrentYear(), -1),MapUtils.getCurrentYear(),MapUtils.getNowOnlyDateFomat1(),null);
		currentTimeZCPNum = tempMaps.get("NUM");
		currentTimeZCCollNum = tempMaps.get("SUMNUM");

		//忠诚献浆员同期总人数	、忠诚献浆员同期献浆总量	
		tempMaps = villageColligateMapper.getZCAllNums(MapUtils.getThatYear(MapUtils.getCurrentYear(), -2),MapUtils.getThatYear(MapUtils.getCurrentYear(), -1),MapUtils.getLastYearNow(),null);
		lastTimeZCPNum = tempMaps.get("NUM");
		lastTimeZCCollNum = tempMaps.get("SUMNUM");

		//忠诚献浆员去年全年献浆总量	
		tempMaps = villageColligateMapper.getZCLastYearCOllNums(MapUtils.getThatYear(MapUtils.getCurrentYear(), -1),MapUtils.getCurrentYear(),MapUtils.getNowOnlyDateFomat1(),null);
		lastYearZCCollNum = tempMaps.get("SUMNUM");
		vill.setCurrentTimeFuSuPNum(CurrentTimeFuSuPNum);
		vill.setCurrentTimeFuSuCollNum(currentTimeFuSuCollNum);
		vill.setCurrentTimeZCPNum(currentTimeZCPNum);
		vill.setCurrentTimeZCCollNum(currentTimeZCCollNum);
		vill.setLastTimeZCPNum(lastTimeZCPNum);
		vill.setLastTimeZCCollNum(lastTimeZCCollNum);
		vill.setLastYearZCCollNum(lastYearZCCollNum);
		

		int comedNotConnPNum = 0;//进站但未被链接的浆员	
		int comedNotConnThisTimeCollNum = 0;//进站未链接浆员当期献浆量	
		int comedNotConnLastTimeCollNum = 0;//进站未链接浆员同期献浆量	
		int comedNotConnLastYearCollNum = 0;//进站未链接浆员去年献浆总量



		//获取指定浆员中，未被链接的浆员
		List<String> comedProvider = MapUtils.retainList(allProvider, MapUtils.allTypeGjzMap.get(GjzType.thisYearComed));
		if(comedProvider.size()>0){
			DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
			StringBuilder comedProvidersBuilder=new StringBuilder();
			for (String string : comedProvider) {
				comedProvidersBuilder.append("'"+string+"'"+",");
			}
			//获取指定浆员中，未被链接的浆员
			List<String> notConnNums = villageColligateMapper.getNotConnProvider(comedProvidersBuilder.toString().substring(0, comedProvidersBuilder.length()-1));
			comedNotConnPNum = notConnNums.size();
			if(notConnNums.size() > 0){
				StringBuilder sb=new StringBuilder();
				for (String string : notConnNums) {
					sb.append("'"+string+"'"+",");
				}
				DataSourceContextHolder.setDataSourceType(DataSourceConst.jingying);
				comedNotConnThisTimeCollNum = villageColligateMapper.getCollNumsByProvider(MapUtils.getCurrentYear() + "-01-01", MapUtils.getNowOnlyDateFomat1(), sb.toString().substring(0, sb.length()-1));
				comedNotConnLastTimeCollNum = villageColligateMapper.getCollNumsByProvider(MapUtils.getThatYear(MapUtils.getCurrentYear(), -1) + "-01-01", MapUtils.getLastYearNow(), sb.toString().substring(0, sb.length()-1));
				comedNotConnLastYearCollNum = villageColligateMapper.getCollNumsByProvider(MapUtils.getThatYear(MapUtils.getCurrentYear(), -1) + "-01-01", MapUtils.getThatYear(MapUtils.getCurrentYear(), -1) + "-12-31", sb.toString().substring(0, sb.length()-1));
			}
		}
		vill.setComedNotConnPNum(comedNotConnPNum);
		vill.setComedNotConnThisTimeCollNum(comedNotConnThisTimeCollNum);
		vill.setComedNotConnLastTimeCollNum(comedNotConnLastTimeCollNum);
		vill.setComedNotConnLastYearCollNum(comedNotConnLastYearCollNum);
		DataSourceContextHolder.setDataSourceType(DataSourceConst.jingying);
		//			currentTimeNotComedPNum;//当期未进站总人数	
//		currentTimeNotComedPNum;//当期未进站总人数	
		StringBuilder allUser=new StringBuilder();
		for (String string : allProvider) {
			allUser.append("'"+string+"'"+",");
		}
		List<String> notComedProviders = villageColligateMapper.getNotComedProvider(MapUtils.getCurrentYear(), MapUtils.getNowOnlyDateFomat1(), allUser.toString().substring(0, allUser.length()-1));
		int CurrentTimeNotComedPNum=notComedProviders.size();
		vill.setCurrentTimeNotComedPNum(CurrentTimeNotComedPNum);


		//			currentTimeNotComedPLastYearCollNum;//当期未进站总人数去年献浆总量袋	
		if(notComedProviders.size()>0){
			StringBuilder sb=new StringBuilder();
			for (String string : notComedProviders) {
				sb.append("'"+string+"'"+",");
			}
			int currentTimeNotComedPLastYearCollNum = villageColligateMapper.getCollNumsByProvider(MapUtils.getThatYear(MapUtils.getCurrentYear(), -1) + "-01-01", MapUtils.getThatYear(MapUtils.getCurrentYear(), -1) + "-12-31", sb.toString().substring(0, sb.length()-1));
			vill.setCurrentTimeNotComedPLastYearCollNum(currentTimeNotComedPLastYearCollNum);
		}

		//			xiuMianPNum;//休眠浆员总人数	
			List<String> xmProvider = MapUtils.retainList(allProvider, MapUtils.allTypeGjzMap.get(GjzType.xiuMianGjz));
		int XiuMianPNum=xmProvider.size();
		vill.setXiuMianPNum(XiuMianPNum);
		if(xmProvider.size()>0){
			//			lastYearXiuMianCollNum;//休眠浆员去年献浆总量/袋	
			int lastYearXiuMianCollNum = villageColligateMapper.getCollNumsByProviders(MapUtils.getThatYear(MapUtils.getCurrentYear(), -1) + "-01-01", MapUtils.getThatYear(MapUtils.getCurrentYear(), -1) + "-12-31", xmProvider);
			//			lastTimeXiuMianCollNum;//休眠浆员同期献浆总量/袋	
			int lastTimeXiuMianCollNum = villageColligateMapper.getCollNumsByProviders(MapUtils.getThatYear(MapUtils.getCurrentYear(), -1) + "-01-01", MapUtils.getLastYearNow(), xmProvider);
			vill.setLastYearXiuMianCollNum(lastYearXiuMianCollNum);
			vill.setLastTimeXiuMianCollNum(lastTimeXiuMianCollNum);			
		}

		//			connXMPNum;//已链接休眠的献浆员	
			List<String> connXMProvider = MapUtils.retainList(allProvider, MapUtils.allTypeGjzMap.get(GjzType.xiuMianBeConnect));
		int ConnXMPNum=connXMProvider.size();
		vill.setConnXMPNum(ConnXMPNum);
		if(connXMProvider.size()>0){
			//			lastTimeConnXMCollNum;//已链接休眠的献浆员同期献浆总量/袋	
			int lastTimeConnXMCollNum = villageColligateMapper.getCollNumsByProviders(MapUtils.getThatYear(MapUtils.getCurrentYear(), -1) + "-01-01", MapUtils.getLastYearNow(), connXMProvider);
			vill.setLastTimeConnXMCollNum(lastTimeConnXMCollNum);
		}
		
		//			notConnXMPNum;//休眠中未链接献浆员	
		List<String> notConnXMProvider = MapUtils.retainList(allProvider, MapUtils.allTypeGjzMap.get(GjzType.xiuMianNotConnect));
		vill.setNotConnXMPNum(notConnXMProvider.size());
		if(notConnXMProvider.size()>0){
			//			lastTimeNotConnXMCollNum;//休眠中未链接献浆员同期献浆总量/袋	
			int lastTimeNotConnXMCollNum = villageColligateMapper.getCollNumsByProviders(MapUtils.getThatYear(MapUtils.getCurrentYear(), -1) + "-01-01", MapUtils.getLastYearNow(), notConnXMProvider);
			vill.setLastTimeNotConnXMCollNum(lastTimeNotConnXMCollNum);
		}
		
		//			liuShiPNum;//流失浆员总人数	
		List<String> lsProvider = MapUtils.retainList(allProvider, MapUtils.allTypeGjzMap.get(GjzType.liuShiGjz));
		int LiuShiPNum=lsProvider.size();
		vill.setLiuShiPNum(LiuShiPNum);
		DataSourceContextHolder.setDataSourceType(DataSourceConst.mx);
		//			connNurseNum;//管理护士总人数
		int connNurseNum = villageColligateMapper.getNewManageNurseNum(allUser.toString().substring(0,allUser.length()-1));
		vill.setConnNurseNum(connNurseNum);
		//		vill.setConnNurseNum(connNurseNum);
		//			connedPNum;//已链接献浆员总人数	
		int connedPNum = villageColligateMapper.getNewConnedPNum(allUser.toString().substring(0,allUser.length()-1));
		vill.setConnedPNum(connedPNum);
		//		vill.setConnedPNum(connedPNum);
		//			VolunteerNum;//义工总人数	
		int volunteerNum = villageColligateMapper.getNewVolunteerNum(allUser.toString().substring(0,allUser.length()-1));
		vill.setVolunteerNum(volunteerNum);
		//			VolunConnGJZNum;//义工管理浆员总人数
		int volunConnGJZNum = villageColligateMapper.getNewVolunConnGJZNum(allUser.toString().substring(0,allUser.length()-1));
		vill.setVolunConnGJZNum(volunConnGJZNum);

		vilList.add(vill);




		return vilList;
	}
}
